﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furion.CMS.Core
{
    /// <summary>
    /// 操作记录
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)]
    public class OperateRecordAttribute : Attribute
    {
        /// <summary>
        /// 操作记录
        /// <para>
        /// 构造函数输入显示名称
        /// </para>
        /// </summary>
        /// <param name="displayName"></param>
        public OperateRecordAttribute(string displayName)
        {
            DisplayName = displayName;
        }

        /// <summary>
        /// 操作记录
        /// <para>
        /// 构造函数输入显示名称与转换处理类
        /// </para>
        /// </summary>
        /// <param name="displayName"></param>
        /// <param name="transitionHandle"></param>
        public OperateRecordAttribute(string displayName, Type transitionHandle)
        {
            DisplayName = displayName;
            TransitionHandle = transitionHandle;
        }

        /// <summary>
        /// 操作记录
        /// <para>
        /// 构造函数输入显示名称与是否是标记字段
        /// </para>
        /// </summary>
        /// <param name="displayName"></param>
        /// <param name="hasTagField"></param>
        public OperateRecordAttribute(string displayName, bool hasTagField)
            : this(displayName)
        {
            HasTagField = hasTagField;
        }

        /// <summary>
        /// 操作记录
        /// <para>
        /// 构造函数输入显示名称+是否是标记字段+转换处理类
        /// </para>
        /// </summary>
        /// <param name="displayName"></param>
        /// <param name="hasTagField"></param>
        /// <param name="transitionHandle"></param>
        public OperateRecordAttribute(string displayName, bool hasTagField, Type transitionHandle)
            : this(displayName, transitionHandle)
        {
            HasTagField = hasTagField;
        }

        /// <summary>
        /// 模块名称
        /// </summary>
        public string DisplayName { get; set; }
        /// <summary>
        /// 是否是标识字段
        /// </summary>
        public bool HasTagField { get; set; }
        /// <summary>
        /// 转换处理程序
        /// </summary>
        public Type TransitionHandle { get; set; }
    }
}
